package com.tangcco.lockwell.controller.student;


import com.tangcco.lockwell.base.RestResponse;
import com.tangcco.lockwell.service.UserEventLogService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController("studentUserEventLogController")
@RequestMapping("/api/student/getUserEventLog")
public class UserEventLogController {

    private final UserEventLogService userEventLogService;


    public UserEventLogController(UserEventLogService userEventLogService) {
        this.userEventLogService = userEventLogService;
    }
    //打卡天数
    @RequestMapping("/counts")
    public RestResponse getUserEventLog() {
        Integer count = userEventLogService.selectCountByUserName();
        return RestResponse.ok(count);
    }

    //用户积分
    @RequestMapping("/integral")
    public RestResponse getIntegral() {
        Integer integral = userEventLogService.selectIntegralByUserName();
        return RestResponse.ok(integral);
    }
    //用户连续登录天数
    @RequestMapping("/keepLearning")
    public RestResponse getKeepLearning() {
        Integer keepLearning = userEventLogService.selectKeepLearning();
        return RestResponse.ok(keepLearning);
    }

    //用户学习进度
    @RequestMapping("/progress")
    public RestResponse getProgress() {
        Double progress = userEventLogService.selectProgressByUserName();
        return RestResponse.ok(progress);
    }

}
